package net.zjitc.arrays;

import java.util.Arrays;

public class MatTest {
    public static void main(String[] args) {
        int[][] arrA = {{1, 2, 3}, {4, 5, 6}}; //2*3
        int[][] arrB = {{5, 2}, {5, 6}, {2, 5}}; //3*2

        int[][] arrC = new int[arrA.length][arrB[0].length];



        for (int i = 0; i <arrA.length ; i++) { //确定行
            for (int j = 0; j < arrB[0].length; j++) { //确定列
                 //求出C矩阵中的某一个元素的值
                int sum=0;
                for (int k = 0; k < arrA[0].length ; k++) {
                    sum = sum + arrA[i][k] * arrB[k][j];
                    arrC[i][j] = sum;
                }
            }
        }


        for (int i = 0; i < arrC.length; i++) {
            System.out.println(Arrays.toString(arrC[i]));
        }

    }
}
